﻿using System.Collections.Generic;



namespace Utils.ModuleCoroutine
{
    /// <summary>
    /// 
    /// </summary>
    public class CoroutineCenter
    {
        /// <summary>
        /// 
        /// </summary>
        public static Dictionary<string, ModuleCoroutine> CoroutineLib { get; private set; } = new Dictionary<string, ModuleCoroutine>();


        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ModuleCoroutine Get(string name)
        {
            if (CoroutineLib == null)
            {
                CoroutineLib = new Dictionary<string, ModuleCoroutine>();
            }


            bool isGet = CoroutineLib.TryGetValue(name, out ModuleCoroutine output);
            if (!isGet)
            {
                output = new ModuleCoroutine();
                CoroutineLib.Add(name, output);
            }

            return output;
        }
    }
}
